home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1997 #3
/
Amiga Plus CD - 1997 - No. 03.iso
/
pd
/
programmierung
/
alienbreed3d2_src
/
amos
/
256floor.amos
/
256floor.amosSourceCode
Wrap
AMOS Source Code
|
1997-01-31
|
2KB
|
106 lines
Screen Open 1,640,24,2,Hires
Palette $8,$FF0 : Paper 0 : Pen 1 : Curs Off : Flash Off : Extension_12_0380 -1
Box 0,4 To 639,20 : Wait Vbl : Screen Display 1,,Y Hard(1,72),,
Reserve As Work 15,65536
Trap Bload "ab3:includes/256pal",15
If Errtrap
Locate 0,1 : Centre "Could not load 'ab3:includes/256pal'"
Wait Key
Edit
End If
Dim R(255),G(255),B(255),PR(63),PG(63),PB(63),CO(63)
S=Start(15)
For A=0 To 255
R(A)=Deek(S) : Add S,2
G(A)=Deek(S) : Add S,2
B(A)=Deek(S) : Add S,2
Next
Reserve As Work 14,100000
For A=1 To 16
M$="ab3:graphics/floors/floor."+Str$(A)-" "
Screen 1 : Locate 0,1 : Centre " Loading Picutre... " : Screen 0
Trap Load Iff M$,0
If Errtrap
Screen 1
Locate 0,1
Centre "Unable to load 'ab3:graphics/floors/floor."+(Str$(A)-" ")+"'"
Wait Key
Edit
End If
Screen To Front 1
Bload M$,Start(14)
S=Hunt(Start(14) To Start(14)+10000,"CMAP")+8
For B=0 To 31
PR(B)=Peek(S) : Add S,1
PG(B)=Peek(S) : Add S,1
PB(B)=Peek(S) : Add S,1
PR(B+32)=PR(B)/2
PG(B+32)=PG(B)/2
PB(B+32)=PB(B)/2
Next
Screen 1 : Locate 0,1 : Centre " Matching Colours... " : Screen 0
For B=0 To 63
ND=100000000 : T=0
For Z=0 To 255
D=Abs(R(Z)-PR(B))+Abs(G(Z)-PG(B))+Abs(B(Z)-PB(B))
If D<ND Then ND=D : T=Z
If D=0 Then Z=255
Next
CO(B)=T
Next
Screen 1 : Locate 0,1 : Centre " Storing Texture... " : Screen 0
B=A-1
S=Start(15)+(B mod 4)+(B/4)*256
For X=0 To 63 : For Y=0 To 63
Poke S+X*4+Y*1024,CO( Extension_12_044C(X,Y))
Extension_12_036E X,Y,0
Next : Next
Next
Trap Bsave "ab3:includes/floortile",Start(15) To Start(15)+65536
If Errtrap
Screen 1
Locate 0,1 : Centre "Unable to save 'ab3:includes/floortile'"
Wait Key
Edit
End If
'N=Start(14)
'For A=32 To 1 Step -1
' For QB=0 To 255
'
' R=(R(QB)*A)/32
' G=(G(QB)*A)/32
' B=(B(QB)*A)/32
'
' ND=100000000 : T=0
' For Z=0 To 255
' D=Abs(R(Z)-R)+Abs(G(Z)-G)+Abs(B(Z)-B)
' If D<ND Then ND=D : T=Z
' If D=0 Then Z=255
' Next
'
' Doke N,(T*256)+T : Add N,2
'
' Next
'Next
'Bsave "ab3:includes/floor256pal",Start(14) To N
Screen 1 : Locate 0,1 : Centre "All Done, Press any key..." : Screen 0
T=Timer
Repeat
I$=Inkey$
Multi Wait
Until(I$<>"") or T>500
Edit